Is there a better way to compose a message based on conditions